export default (url) => {
  const crud = window.$crud(url);
  const getHistoryPage = (id, qureyData) =>
    window.$axios({
      url: `${url}/history/page/${id}`,
      method: "get",
      params: qureyData,
    });
  const getHistory = (id) =>
    window.$axios({
      url: `${url}/history/${id}`,
      method: "get",
    });
    const updateState = (state, id) =>
    window.$axios({
      url: `${url}/state/${id}`,
      method: "put",
      params: {state: state},
    });
  const getByCode = (code) =>
    window.$axios({
      url: `${url}/code/${code}`,
      method: "get",
  });

  const getInfoByCode = (code) =>
    window.$axios({
      url: `${url}/info/code/${code}`,
      method: "get",
    });


  return {
    ...crud,
    getHistoryPage,
    getHistory,
    updateState,
    getByCode,
    getInfoByCode
  };
};
